package com.zbkj.crmeb.chant.service;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

import com.baomidou.mybatisplus.extension.service.IService;
import com.common.PageParamRequest;
import com.zbkj.crmeb.chant.model.ChannelMerchantAccount;
import com.zbkj.crmeb.chant.request.*;
import com.zbkj.crmeb.chant.response.AccountCenterResponse;
import com.zbkj.crmeb.chant.response.AccountCenterResponse.Bill;
import com.zbkj.crmeb.chant.response.SupplierAccountCenterResponse;
import com.zbkj.crmeb.chant.response.SupplierAccountCenterResponse.SupplierBill;
import com.zbkj.crmeb.export.vo.SupplierFlowExcelVo;
import com.zbkj.crmeb.finance.controller.WithdrawalAuditRequest;
import com.zbkj.crmeb.finance.model.UserRecharge;

/**
 * 渠道商户
 */
public interface IChannelMerchantAccountService extends IService<ChannelMerchantAccount> {

    /**
     * 渠道资金计算, 必传渠道id, 资金增加传正数, 减传负数, 只需要传变化的部分
     * @Description:  
     * @author daigb 
     * @param @param entity
     * @param @return
     * @return CommonResult<String>
     * @throws
     */
    Integer calcMoney(ChannelMerchantAccount entity);

    /**
     * 商户余额低于5000的预警通知
     * @param merIds
     * @return
     */
    Map<String, Object> getAmountWarning(List<Integer> merIds);

    /**
     * 商户线下充值
     * @Description:  
     * @author daigb 
     * @param @param request
     * @param @param ip
     * @param @return
     * @return Boolean
     * @throws
     */
    Boolean offlineRecharge(OfflineRechargeRequest request, String ip);
    
    /**
     * 商户线下提现申请
     * @Description:  
     * @author daigb 
     * @param @param merId
     * @param @param price
     * @param @param ip
     * @param @return
     * @return Boolean
     * @throws
     */
    Boolean offlineWithdrawApply(Integer merId, BigDecimal price, String ip);
    
    /**
     * 提现申请审核
     * @Description:  
     * @author daigb 
     * @param @param merId
     * @param @param price
     * @param @param ip
     * @param @return
     * @return Boolean
     * @throws
     */
    Boolean offlineWithdrawAudit(UserRecharge userRecharge, WithdrawalAuditRequest req, String ip);

    /**
     * 渠道商户账户中心
     * @param request
     * @return
     */
    AccountCenterResponse accountCenter(AccountCenterRequest request);

    /**
     * 账户中心查看详情
     * @param id
     * @param tag true:总后台 false:商户后台
     * @return
     */
    Object accountInfo(Integer id,boolean tag);

    /**
     * 补偿性充值
     * @param request
     * @param ip
     * @return
     */
    boolean offlineCompensatory(OfflineCompensatoryRequest request, String ip);

    /**
     * 冻结/解冻商户账户
     * @param id
     * @return
     */
    Boolean accountFrozen(Integer id,Boolean status);

    List<Bill> getFlowList(Integer merId, Integer type);

    SupplierAccountCenterResponse supplierAccountCenter(Integer merId, PageParamRequest pageParamRequest);

    Boolean settlementSupplier(SettlementSupplierRequest request,String ip);

    List<SupplierFlowExcelVo> parseSupplierExportList(List<SupplierBill> billList);

    AppletAccountRequest getAppletAccount(Integer merId);

    boolean saveAppletAccount(Integer merId, AppletAccountRequest request);

    /**
     * 功能描述: 更新供应商备用金
     * @Param: [merId, money]
     * @Return: java.math.BigDecimal
     * @Author: wangzh
     * @Date: 2023/5/9 14:01
     */
    BigDecimal calReserveMoney(Integer supplierId, BigDecimal money);
}
